uname_to_goarch() {
    # user $(uname -m)
    local uname_arch=$1
    local goarch=""

    case "$uname_arch" in
    x86_64) goarch="amd64" ;;              # 64-bit x86
    i386 | i686) goarch="386" ;;           # 32-bit x86
    armv7l | armv6l | arm) goarch="arm" ;; # 32-bit ARM
    aarch64) goarch="arm64" ;;             # 64-bit ARM
    riscv64) goarch="riscv64" ;;           # 64-bit RISC-V
    ppc64) goarch="ppc64" ;;               # 64-bit PowerPC (Big Endian)
    ppc64le) goarch="ppc64le" ;;           # 64-bit PowerPC (Little Endian)
    s390x) goarch="s390x" ;;               # IBM Z-Series (64-bit)
    mips) goarch="mips" ;;                 # 32-bit MIPS (Big Endian)
    mipsle) goarch="mipsle" ;;             # 32-bit MIPS (Little Endian)
    mips64) goarch="mips64" ;;             # 64-bit MIPS (Big Endian)
    mips64le) goarch="mips64le" ;;         # 64-bit MIPS (Little Endian)
    *) goarch="unknown" ;;                 # Fallback for unsupported architectures
    esac

    echo "$goarch"
}
